#ifndef __DIRECT_H
#define __DIRECT_H

#include "..\DuiLib\UIlib.h"
using namespace DuiLib;

#ifdef _DEBUG
#   ifdef _UNICODE
#       pragma comment(lib, "..\\lib\\duilib_ud.lib")
#   else
#       pragma comment(lib, "..\\lib\\duilib_d.lib")
#   endif
#else
#   ifdef _UNICODE
#       pragma comment(lib, "..\\lib\\duilib_u.lib")
#   else
#       pragma comment(lib, "..\\lib\\duilib.lib")
#   endif
#endif





//*********************
#define BtnPopup           _T("btn_popupdialog")
#define BtnText            _T("btn_displaytext")
#define BtnModify          _T("btn_modifytext")
#define BtnResource        _T("btn_displayresource")
#define RechEditResource   _T("richedit_resourcename")

#define PanelIP            _T("panel_ipenter")
#define EditIPA            _T("edit_ipenter_a")
#define EditIPB            _T("edit_ipenter_b")
#define EditIPC            _T("edit_ipenter_c")
#define EditIPD            _T("edit_ipenter_d")
#define IP                 _T("panel_iprealy")
//*********************


class CControl : public CContainerUI
{
public:
	CControl();

};

class CDialogBuilderCallbackEx : public IDialogBuilderCallback
{
public:
	CControlUI* CreateControl(LPCTSTR pstrClass);

};


class CDirectWnd:public CWindowWnd ,public INotifyUI
{
	CButtonUI* m_pCloseBtn;
	CButtonUI* m_pMaxBtn;
	CButtonUI* m_pRestoreBtn;
	CButtonUI* m_pMinBtn;
	static CRichEditUI* m_pResource ;
	static WORD m_wLang;
	static TCHAR m_szResName[256];
	static TCHAR m_szResType[256] ;
	CContainerUI* m_pPanelIP;
	//CIPEditUI* m_pIPA;
	//CIPEditUI* m_pIPB;
	//CIPEditUI* m_pIPC;
	//CIPEditUI* m_pIPD;

	CContainerUI* m_pIPPanel;
	//CIPEditUI* m_pIP;
	void* m_pEvery;

public:
	CPaintManagerUI m_pm;
	CDirectWnd();
	LPCTSTR GetWindowClassName()const;
	UINT GetClassStyle() const;
	void OnFinalMessage(HWND /*hWnd*/);
	void Init();
	void OnPrepare(void);
	void Notify(TNotifyUI& msg);
	LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnNcActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnNcCalcSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnGetMinMaxInfo(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
	void AlignTitleButton();
	HWND CenterCreate(HWND hwndParent, LPCTSTR pstrName, DWORD dwStyle, DWORD dwExStyle,int cx = CW_USEDEFAULT, int cy = CW_USEDEFAULT, HMENU hMenu = NULL);
	void OnPopup(TNotifyUI& msg);
	void OnDisplay(TNotifyUI& msg);
	void OnModifyText(TNotifyUI& msg);
	void OnEnumResource(TNotifyUI& msg);
	static BOOL EnumNameFunc(HANDLE hModule , LPCTSTR lpType , LPTSTR lpName , LONG lParam);
	static BOOL EnumLangsFunc( HANDLE hModule, LPCTSTR lpType, LPCTSTR lpName, WORD wLang,LONG lParam);
	static BOOL EnumTypesFunc( HANDLE hModule, LPTSTR lpType, LONG lParam);
	void OnEnterIP(TNotifyUI& msg);
	LRESULT OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
};

#endif //__DIRECT_H
